<?php
require_once ('../lib/config.php');
require_once ('../lib/facebook.php');
require_once ('../lib/friends.php');
require_once ('../lib/friend.php');
require_once ('../lib/test.php');
require_once ('../lib/init.php');
require_once ('f:/wamp/www/simpletest/autorun.php');
  

class TestTemplate extends UnitTestCase {

    function testOutboxMessages(){

        $me = getOneself();
        $friends = getFriends();
        $outMsgs = getOutboxMessages();
        

        //count the number of unique receivers per a message and sum it
        $n = 0;
        if(is_array($outMsgs)){
            foreach ($outMsgs as $msg) {
                $id = $msg['from']['id'];
                if($id == $me['id']){
                    if(!empty($msg['to'])){
                        $receivers = $msg['to']['data'];
                        $n += (count($receivers)-1);                    
                    }
                }
            }
        }
        processOutboxMessages($friends);
        $m = func1($friends);
        print($m);
        $this->assertEqual($n, $m);
        
    }
    

}


?>

    